package com.google.code.jmarias.client.components;

import com.google.code.jmarias.client.Globals;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.state.StateBasedGame;

/**
 * Komponenta zajistujici vykresleni tlacitek v menu.
 * @author bart
 */
public class ButtonRenderComponent extends AbstractRenderComponent {
    private Image imgNormal = null;
    private Image imgHover = null;
    private Globals global;

    public ButtonRenderComponent(int id, Globals global, Image imgNormal, Image imgHover) {
        super(id);
        this.imgNormal = imgNormal;
        this.imgHover = imgHover;
        this.global = global;
    }


    public void render(GameContainer gc, StateBasedGame sb, Graphics gr) {
        Vector2f pos = owner.getPosition();
        float scale = owner.getScale();

        if(global.getHoverID() == id + 1) {
            imgHover.draw(pos.x, pos.y, scale);
        } else {
            imgNormal.draw(pos.x, pos.y, scale);
        }

    }


    public void update(GameContainer gc, StateBasedGame sb, int delta) {
    }



}
